/**
 * Created by z30 on 15-6-5.
 */


var log4js = require('log4js');
//var type            = require('../servertype.json');

log4js.configure({
    appenders: [
        {
            type: "console",
            category: "console" //注释掉就控制台输出
        },
        {
            type: "file",
            filename: './logs/wxshop.log',
            alwaysIncludePattern: true,
            pattern: "_yyyy-MM-dd",
            backups: 10,
            category: 'wxshop'
        }//日期文件格式
    ],
    replaceConsole: true,   //替换console.log
    levels:{
        dateFileLog: 'debug',
        console: 'debug'
    }
});

var dateFileLog = log4js.getLogger('wxshop');
exports.logger = dateFileLog;
exports.use = function(app) {
    //页面请求日志,用auto的话,默认级别是WARN
    //app.use(log4js.connectLogger(dateFileLog, {level:'auto', format:':method :url'}));
    app.use(log4js.connectLogger(dateFileLog, {
        format:':remote-addr :method :url :status :response-time'+'ms'}));
};